import React,{Component} from 'react';
import {BrowserRouter as Router, Route,Link } from "react-router-dom";
import Head from './common/Head';
import {Layout, Menu, Select} from 'antd';
import RecordByDate from './RecordByDate';
import RecordByPro from './RecordByPro';

const {
    Sider,Content
  } = Layout;

class Record extends Component{

    constructor(props){
        super(props);
        
        this.state = {
            urlpath:this.props.match.path,
            columns:[
                {
                    title: '流水号',
                    dataIndex: 'serialNumber',
                    key: 'serialNumber'
                },
                {
                    title: '出入库',
                    dataIndex: 'opeType',
                    key: 'opeType'
                },
                {
                    title: '日期',
                    dataIndex: 'createTime',
                    key: 'createTime'
                },
                {
                    title: '操作',
                    dataIndex: 'operate',
                    key: 'operate',
                    render:(text, record) => (
                        <span>
                            <a onClick={()=>this.showDetail(record)}>查看详情</a>
                        </span>
                    )
                },
            ],
            data:[]
        }
    }

    render(){
        return(
            <div>
                <Head urlpath={this.state.urlpath}></Head>
                <Layout>
                    <Sider breakpoint="lg" collapsedWidth="0" width={200} style={{ background: '#fff' }}>
                        <Menu mode="inline" defaultSelectedKeys={['1']}>
                            <Menu.Item key="1">
                                <span></span>
                                <Link to="/record/recordByDate">按日期查询</Link>
                            </Menu.Item>
                            <Menu.Item key="2">
                                <Link to="/record/recordByPro">按商品查询</Link>
                            </Menu.Item>
                        </Menu>
                    </Sider>
                    <Layout style={{ padding: '0 24px 24px' }}>
                        <Content style={{ background: '#fff', padding: 24, margin: 0, minHeight: 280, }}>
                            <Route exact path="/record/" component={RecordByDate} />
                            <Route exact path="/record/recordByDate" component={RecordByDate} />
                            <Route exact path="/record/recordByPro" component={RecordByPro} />
                        </Content>
                    </Layout>
                </Layout>
            </div>
            
        );
    }
}
export default Record;